# -*- coding: utf-8 -*-
import sys;

languages = [ "C", "C++", "Perl", "Python" ];
for x in languages:
    print ( x );

# 不含50
print( "\r\nrange:" );
for i in range( 5, 50, 5 ):
    print( i );

# 3 : Python
print( "\r\n key => val:" );
for key2lan,val2lan in enumerate( languages ):
    print( key2lan, ':', val2lan );

# 循环中的 break continue


# 迭代器
list=[ 1, 2, 3, 4 ];
it = iter( list );    # 创建迭代器对象
# print (next(it))   # 输出迭代器的下一个元素

print( "for遍历迭代器:" );
for x in it:
    print ( x, end=" " );

print( "while遍历迭代器:" );
i = 0;
while True:
    try:
        print (next(it))
    except StopIteration:
        sys.exit()